Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve DataDog metric shipping, this way filtering/grouping is much … #556

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

aceclan
Copy link

@aceclan aceclan commented Aug 10, 2021

Summary

This PR improving DataDog metric shipping, this way filtering/grouping is much easier.

  • Introducing awslimitcheckr.usage and awslimitchecker.limit instead of awslimitchecker.service_group.service_name.limit / usage

  • max_usage actually is the actual usage, that's why is replaced for datadog

  • Here is an example output generated by the following command what should be sent to DataDog.

awslimitchecker \
     --metrics-provider Datadog \
     --metrics-config=api_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
     --metrics-config=extra_tags=env:eu-west-1.test,stage:test \

....
    {
      "metric": "awslimitchecker.usage",
      "points": [
        [
          12546,
          0
        ]
      ],
      "type": "gauge",
      "tags": [
        "region:eu-west-1",
        "env:eu-west-1.test",
        "stage:test",
        "service:apigateway.api_keys_per_account",
        "service_group:apigateway",
        "apigateway"
      ]
    },
    {
      "metric": "awslimitchecker.limit",
      "points": [
        [
          12463,
          10
        ]
      ],
      "type": "gauge",
      "tags": [
        "region:eu-west-1",
        "env:eu-west-1.test",
        "stage:test",
        "service:apigateway.api_keys_per_account",
        "service_group:apigateway",
        "apigateway"
      ]
    },
...

This way can be selected and group by service_group, service, env, stage (tags on aws: from, over, sum by)

Contributor License Agreement

By submitting this work for inclusion in awslimitchecker, I agree to the following terms:

  • The contribution included in this request (and any subsequent revisions or versions of it)
    is being made under the same license as the awslimitchecker project (the Affero GPL v3,
    or any subsequent version of that license if adopted by awslimitchecker).
  • My contribution may perpetually be included in and distributed with awslimitchecker; submitting
    this pull request grants a perpetual, global, unlimited license for it to be used and distributed
    under the terms of awslimitchecker's license.
  • I have the legal power and rights to agree to these terms.

Pull Request Checklist

  • All pull requests should be against the develop branch, not master.
  • All pull requests must include the Contributor License Agreement.
  • Whether or not your PR includes unit tests:
    • Please make sure you have run the exact code contained in the PR locally, and it functions as desired.
    • Please make sure the TravisCI build passes or, if not, you've corrected any obvious problems identified by the tests.
  • Code should conform to the Development Guidelines:
    • pep8 compliant with some exceptions (see pytest.ini)
    • 100% test coverage with pytest (with valid tests). If you have difficulty
      writing tests for the code, that's fine, just mention that in the summary and either
      ask for assistance, or clarify that you'd like someone else to handle the tests. PRs that
      include complete test coverage will usually be merged faster.
    • Complete, correctly-formatted documentation for all classes, functions and methods.
    • documentation has been rebuilt with tox -e docs
    • Connections to the AWS services should only be made by the class's
      connect() and connect_resource() methods, inherited from
      awslimitchecker.connectable.Connectable
    • All modules should have (and use) module-level loggers.
    • Commit messages should be meaningful, and reference the Issue number
      if you're working on a GitHub issue (i.e. "issue #x - "). Please
      refrain from using the "fixes #x" notation unless you are sure that the
      the issue is fixed in that commit.
    • Git history is fully intact; please do not squash or rewrite history.

@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2021

Codecov Report

Merging #556 (608e9c6) into develop (411ad9e) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop      #556   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        44           
  Lines         3294      3302    +8     
  Branches       485       486    +1     
=========================================
+ Hits          3294      3302    +8     
Impacted Files Coverage Δ
awslimitchecker/metrics/datadog.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 411ad9e...608e9c6. Read the comment docs.

@aceclan
Copy link
Author

aceclan commented Aug 13, 2021

Hi @jantman ,

Please review when You will have time, I think it is useful this modification. This way it can be created dashboards or alerts for multiple services in one step.

Best regards,
Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants